package processor;

import org.apache.http.HttpHost;
import us.codecraft.webmagic.Page;
import us.codecraft.webmagic.Site;
import us.codecraft.webmagic.Spider;
import us.codecraft.webmagic.downloader.selenium.SeleniumDownloader;
import us.codecraft.webmagic.processor.PageProcessor;

import java.util.List;

/**
 * Created by zhangcheng on 2017/4/21 0021.
 * 爬虫---中国民航局
 */
public class CaacPageProcessor implements PageProcessor{

    private Site site = Site.me()
            .setRetryTimes(3)
            .setHttpProxy(new HttpHost("10.101.1.6",80))
            .setSleepTime(1000);
    public void process(Page page) {
        System.out.println(page.getHtml());
    }

    public Site getSite() {
        return this.site;
    }

    public static void main(String[] args) {
        Spider.create(new CaacPageProcessor()).setDownloader(new SeleniumDownloader()).addUrl("https://www.capse.net/airline").run();
    }
}
